package marlon.sjf;

/**
 * @author marlonyao<yaolei135@gmail.com>
 *
 */
public class SJFException extends RuntimeException {
	private SJFErrorCode errorCode;
	
	public SJFException(SJFErrorCode errorCode) {
		this.errorCode = errorCode;
	}
	
	public SJFException(SJFErrorCode errorCode, String message) {
		super(message);
		this.errorCode = errorCode;
	}
	
	public String toString() {
		String result = String.format("ERROR %s: %s", errorCode.getCode(),errorCode.getDescription());
		if (getMessage() != null) {
			result += "[" + getMessage() + "]";
		}
		return result;
	}
}
